<template>
  <div class="o-top-bar">
    <img src="./../../../assets/top-bar/top_bar_bg.png" alt="" class="bg" />
    <div class="o-title">
      <div class="left">
        <div class="nav-item" :class="{ ['active-nav']: fullPath === '/collection/point' }" @click="handeJump('/collection/point')">
          <img src="./../../../assets/top-bar/nav_bg.png" class="nav-bg-num" />
          <div class="nav-text">采集点信息管理</div>
        </div>
        <div class="nav-item" :class="{ ['active-nav']: fullPath === '/sample/base-info' }" @click="handeJump('/sample/base-info')">
          <img src="./../../../assets/top-bar/nav_bg.png" class="nav-bg-num" />

          <div class="nav-text">样本基本信息管理</div>
        </div>
      </div>
      <div class="center" @click="handeJump('/sample/dispose-info')">树木年轮生态实验室业务子系统</div>
      <div class="right">
        <div class="nav-item" :class="{ ['active-nav']: fullPath === '/sample/dispose-info' }" @click="handeJump('/sample/dispose-info')">
          <img src="./../../../assets/top-bar/nav_bg_right.png" class="nav-bg-num" />
          <div class="nav-text">样本处理信息管理</div>
        </div>
        <div
          class="nav-item"
          :class="{ ['active-nav']: fullPath === '/tree-achievement/index' }"
          @click="handeJump('/tree-achievement/index')"
        >
          <img src="./../../../assets/top-bar/nav_bg_right.png" class="nav-bg-num" />
          <div class="nav-text">树轮成果管理</div>
        </div>
      </div>
    </div>
    <div class="bar-wrap">
      <div class="left">
        <div class="home o-icon">
          <vab-icon :icon="['fas', 'home']" color="#fff" />
        </div>
        <div class="stting o-icon">
          <vab-icon :icon="['fas', 'cog']" color="#fff" />
        </div>
        <div class="countdown">8888</div>
      </div>
      <div class="right">
        <div class="home o-icon">
          <vab-icon :icon="['fas', 'user']" color="#fff" />
        </div>
        <div class="search o-icon">
          <vab-icon :icon="['fas', 'search']" color="#fff" />
        </div>
        <div class="notice o-icon">
          <vab-icon :icon="['fas', 'bell']" color="#fff" />
        </div>
        <div class="user o-icon">
          <vab-icon :icon="['fas', 'user']" color="#fff" />
        </div>
      </div>
    </div>
  </div>
</template>
<script>
  export default {
    name: 'OTopBar',
    data() {
      return {
        curTime: process.env.VUE_APP_UPDATE_TIME,
        fullPath: this.$route.fullPath,
      }
    },
    mounted() {
      console.log('----======', this.$routefullPath)
    },
    watch: {
      $route() {
        // let a = this.getBreadcrumb()
        // console.log('----======')
        this.fullPath = this.$route.fullPath
      },
    },
    methods: {
      // 跳转
      handeJump(path) {
        console.log('-path')
        if (path === this.fullPath) {
          return
        }
        this.$router.push({ path: path })
      },
      getBreadcrumb() {
        return this.$route.matched.filter((item) => item.name && item.meta.title)
      },
    },
  }
</script>
<style lang="scss" scoped>
  .o-top-bar {
    position: relative;
    width: 100%;
  }
  .bg {
    display: block;
    width: 100%;
    height: 110px;
  }
  .o-title {
    position: relative;
    z-index: 2;
  }
  .bar-wrap {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: space-between;
    // align-items: center;
    padding: 32px 20px 0;
    box-sizing: border-box;

    .left {
      display: flex;

      .home {
      }
      .stting {
        padding: 0 15px;
      }
    }
    .o-icon {
      font-size: 30px;
    }
    .countdown {
      font-family: 'Impact Normal', 'Impact', sans-serif;
      font-weight: 400;
      font-style: normal;
      font-size: 24px;
      color: #ffffff;
    }

    .right {
      display: flex;

      .o-icon {
        margin-left: 20px;
      }
    }
  }

  .o-title {
    position: absolute;
    width: 100%;
    height: 100%;
    left: 0;
    top: 0;
    display: flex;
    justify-content: center;
    .left,
    .right {
      display: flex;
      margin-top: 30px;
    }

    .nav-item {
      position: relative;
      font-family: '阿里巴巴普惠体 Medium', '阿里巴巴普惠体', sans-serif;
      font-weight: 500;
      font-style: normal;
      font-size: 16px;
      color: #ffffff;
      padding: 5px 0 0 0;

      text-align: center;
      .nav-text {
        width: 161px;
        height: 34px;
        padding-top: 10px;
        background-image: url('./../../../assets/top-bar/nav_bg_normal.png');
        background-size: 100% 100%;
        box-sizing: border-box;
      }

      .nav-bg-num {
        position: absolute;

        top: 0;
        width: 111px;
        height: 41px;
      }
    }

    .left {
      .active-nav .nav-text {
        background-image: url('./../../../assets/top-bar/act_nav_left.png');
      }
      .nav-bg-num {
        left: 10px;
      }
    }
    .right {
      .nav-text {
        background-image: url('./../../../assets/top-bar/normal_right.png');
        background-size: 100% 100%;
      }
      .nav-bg-num {
        right: 10px;
      }
      .active-nav .nav-text {
        background-image: url('./../../../assets/top-bar/act_nav_right.png');
      }
    }

    .center {
      margin: 10px 80px;
      // width: 590px;
      color: #fff;
      text-shadow: 0px 0px 10px rgba(0, 200, 244, 1);
      font-size: 38px;
      font-weight: 700;
      text-align: center;
      font-family: '庞门正道标题体免费版 Bold', '庞门正道标题体免费版 常规', '庞门正道标题体免费版', sans-serif;
    }
  }
</style>
